package com.qding.park.common.core.exceptions.business.manager.service;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.qding.park.common.core.exceptions.ExceptionMessage;
import com.qding.park.common.core.exceptions.ModularEnum;
import com.qding.park.common.core.exceptions.business.ServiceException;
import com.qding.park.common.core.exceptions.business.manager.adapterfactory.AdapterProxyCreateFail;

public class ServiceCoreException extends ServiceException{
	
	
	private static final Log _log = LogFactory.getLog(ServiceCoreException.class);
	public static enum TypeEnum {
		
		EXCEPTION_NOFIND_USER(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0001","业务异常--找不到此用户"),
		EXCEPTION_EXIST_PHONEUSER(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0002","业务异常--此手机号已经和别的用户id绑定"),
		EXCEPTION_NOFIND_PARK(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0003","业务异常--没有此车场"),
		EXCEPTION_NOFIND_CAR(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0004","业务异常--没有此车辆信息"),
		EXCEPTION_NOFIND_SUPPLY(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0005","业务异常--没有找到车场供应商"),
		EXCEPTION_INVITATION_CANCEL(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0006","业务异常--取消邀请异常"),
		EXCEPTION_NOTFIND_INVITATION(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0007","业务异常--找不到此邀请"),
		EXCEPTION_MONTHCARD_NOTPAY(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0008","业务异常--此月卡不能冲值"),
		EXCEPTION_CAR_NOTIN_PARK(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0009","业务异常--车辆没有停在车场里面"),
		EXCEPTION_EXIST_CARLOCAK(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0010","业务异常--车辆已经被锁"),
		EXCEPTION_CAR_RESERVED(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0011","业务异常--该车辆已预约过车位"),
		EXCEPTION_DATA_DIFF(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0012","业务异常--数据不一致性"),
		EXCEPTION_NOTFIND_CARLOCK(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0013","业务异常--找不锁车单"),
		EXCEPTION_NOTFIND_PARKRULE(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0014","业务异常--找不到车场规则"),
		EXCEPTION_INCHECKED_CAR(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0015","业务异常--车辆已进场"),
		EXCEPTION_EXIST_INVITATION(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0015","业务异常--此邀请已存在"),
		EXCEPTION_NO_STOPSPACE(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0016","业务异常--没有车位"),
		EXCEPTION_NO_DATA_INVALID(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0017","业务异常--失效数据"),
		EXCEPTION_NO_DATA_SAVE(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0018","业务异常--失败的保存数据"),
		EXCEPTION_NO_DATA_FIND(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0019","业务异常--没有找到数据"),
		EXCEPTION_NO_DATA_UPDATE(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0020","业务异常--失败的更新操作"),
		EXCEPTION_DATA_LOCKED(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0021","业务异常--资源被锁定"),
		EXCEPTION_NOT_ALL_SUCCESS(ModularEnum.MODULAR_MANAGER_SERVICE_CORE.getId() +".0022","业务异常--不完全成功");
		
		
		private String id;
		
		private String desc;
		
		private TypeEnum(String id,String desc){
			this.id=id;
			this.desc=desc;
		}

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		
		
	}
	
	private ExceptionMessage exceptionMessage;
	
	public ServiceCoreException(ExceptionMessage exceptionMessage, Exception ex) {
		super(null, ex);
		this.exceptionMessage=exceptionMessage;
		// TODO Auto-generated constructor stub
	}

	
	/**
	 * @Description TODO(这里用一句话描述这个方法的作用)
	 * @param id  编号
	 * @param ex  异常
	 * @param exceptionMessage  消息
	 */
	public ServiceCoreException(String id,Exception ex,ExceptionMessage exceptionMessage) {
		super(id,ex,null);
		this.exceptionMessage=exceptionMessage;
		// TODO Auto-generated constructor stub
	}
	/**
	 * @Field @serialVersionUID : TODO(这里用一句话描述这个类的作用)
	 */
	private static final long serialVersionUID = 1L;

	public ExceptionMessage getExceptionMessage() {
		return exceptionMessage;
	}

	
	public void setExceptionMessage(ExceptionMessage exceptionMessage) {
		this.exceptionMessage = exceptionMessage;
	}
	
	public void handle() {

		_log.error("AdapterException Context::" + this.exceptionMessage);
		super.handle();

	}

}
